home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 317 / asmsrc / subsegs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  2.8 KB  |  68 lines

  1. /* subsegs.h -> subsegs.c */
  2.  
  3. /* Copyright (C) 1987 Free Software Foundation, Inc.
  4.  
  5. This file is part of Gas, the GNU Assembler.
  6.  
  7. The GNU assembler is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY.  No author or distributor
  9. accepts responsibility to anyone for the consequences of using it
  10. or for whether it serves any particular purpose or works at all,
  11. unless he says so in writing.  Refer to the GNU Assembler General
  12. Public License for full details.
  13.  
  14. Everyone is granted permission to copy, modify and redistribute
  15. the GNU Assembler, but only under the conditions described in the
  16. GNU Assembler General Public License.  A copy of this license is
  17. supposed to have been given to you along with the GNU Assembler
  18. so you can know your rights and responsibilities.  It should be
  19. in a file named COPYING.  Among other things, the copyright
  20. notice and this notice must be preserved on all copies.  */
  21.  
  22. /*
  23.  * For every sub-segment the user mentions in the ASsembler program,
  24.  * we make one struct frchain. Each sub-segment has exactly one struct frchain
  25.  * and vice versa.
  26.  *
  27.  * Struct frchain's are forward chained (in ascending order of sub-segment
  28.  * code number). The chain runs through frch_next of each subsegment.
  29.  * This makes it hard to find a subsegment's frags
  30.  * if programmer uses a lot of them. Most programs only use text0 and
  31.  * data0, so they don't suffer. At least this way:
  32.  * (1)    There are no "arbitrary" restrictions on how many subsegments
  33.  *    can be programmed;
  34.  * (2)    Subsegments' frchain-s are (later) chained together in the order in
  35.  *    which they are emitted for object file viz text then data.
  36.  *
  37.  * From each struct frchain dangles a chain of struct frags. The frags
  38.  * represent code fragments, for that sub-segment, forward chained.
  39.  */
  40.  
  41. struct frchain            /* control building of a frag chain */
  42. {                /* FRCH = FRagment CHain control */
  43.   struct frag *    frch_root;    /* 1st struct frag in chain, or NULL */
  44.   struct frag *    frch_last;    /* last struct frag in chain, or NULL */
  45.   struct frchain * frch_next;    /* next in chain of struct frchain-s */
  46.   segT        frch_seg;    /* SEG_TEXT or SEG_DATA. */
  47.   subsegT    frch_subseg;    /* subsegment number of this chain */
  48. };
  49.  
  50. typedef struct frchain frchainS;
  51.  
  52. extern frchainS * frchain_root;    /* NULL means no frchains yet. */
  53.                 /* all subsegments' chains hang off here */
  54.  
  55. extern frchainS * frchain_now;
  56.                 /* Frchain we are assembling into now */
  57.                 /* That is, the current segment's frag */
  58.                 /* chain, even if it contains no (complete) */
  59.                 /* frags. */
  60.  
  61. extern frchainS * data0_frchainP;
  62.                 /* Sentinel for frchain crawling. */
  63.                 /* Points to the 1st data-segment frchain. */
  64.                 /* (Which is pointed to by the last text- */
  65.                 /* segment frchain.) */
  66.  
  67. /* end: subsegs.h */
  68.